import { _decorator, Component, Node } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('bg')
export class bg extends Component {
    @property
    speed: number = 4;
	@property
    width: number = 288;
    start() {

	}

    update(deltaTime: number) {
        for (let i of this.node.children) {
            i.setPosition(
                i.getPosition().x - (deltaTime * this.speed),
                0
            );
            if (i.getPosition().x <= -this.width) {
                i.setPosition(this.width-10, 0);
            }
        }
    }
}
